package ch6;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class InputScore2 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("输入姓名：");
        String name=in.next();
        double score=0;
        double s=0;
        int i=1;
        for(;i<=5;i++){
            System.out.println("请输入第"+i+"门课的成绩：");
            s=in.nextDouble();
            if(s<0){
                //System.out.println("输入错误！@");

                break;
            }
            score+=s;
        }
        if(i>5){
            double avg=score/5;
            System.out.println("平均分是"+avg);
        }else{
            System.out.println("输入错误！@");
        }

    }
}
